package org.example.commodity.service.stroage;

import org.apache.ibatis.annotations.*;
import org.example.commodity.data.entity.CommodityEntity;

@Mapper
public interface CommodityEntityMapper {

    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    @Insert("insert into t_commodity_entity(code, name, image, price, state, create_timestamp) value(#{code}, #{name}, #{image}, #{price}, #{state}, #{create_timestamp})")
    public Integer insertCommodityEntity(CommodityEntity commodityEntity);

    @Select("select * from t_commodity_entity where id = #{id}")
    public CommodityEntity selectCommodityEntityById(Long id);

    @Update("update t_commodity_entity set price = #{price} where id = #{id}")
    public Integer updateCommodityEntity(CommodityEntity commodityEntity);

}
